#pragma once
#include "RenderObject.h"
#include "Matrix.h"
#include "protocol.h"
#include "MyMath.h"

using namespace NBE;

namespace NOEXIT
{
	class Bullet
	{
	public:
		Bullet(PlayerInfo& playerinfo, vec3f& dir);
		Bullet(BulletInfo* binfo);
		~Bullet();
		inline RenderObject* getRenderObjcet(){return pRO;}
				
		void updatePos()	 
		{
			info->pos[0] += info->velocity[0];
			info->pos[1] += info->velocity[1];
			info->pos[2] += info->velocity[2];
			m_pos_mat[12] = info->pos[0];
			m_pos_mat[13] = info->pos[1];
			m_pos_mat[14] = info->pos[2];
		}

		inline vec3f getPos(){return vec3f(info->pos);};
		inline Matrix4f& getPosMat()
		{
			 return m_pos_mat;
		}
		inline void setPos(vec3f& po){memcpy_s(info->pos,3*sizeof(float),&po,3*sizeof(float));} 

		inline vec3f getVel(){return vec3f(info->velocity);}

		inline void setBulletInfo(BulletInfo* binfo)
		{
			memcpy_s(&info,sizeof(BulletInfo),binfo,sizeof(BulletInfo));
		}

		inline BulletInfo* getBulletInfo()
		{
			return info;
		}

		int getPlayerId(){return info->playerId;}
		 
	private:
		BulletInfo* info;
		RenderObject* pRO;

		Matrix4f m_pos_mat;
	};
}